<!--  基本信息 -->
<template>
	<uni-section title="基本信息" type="line"></uni-section>
	<uni-card spacing="0" padding="0" margin="0 10px 10px" :is-shadow="false" :border="false">
		<view class="details-dom">
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">姓名</view>
				<view class="content">{{detailsData.name}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">性别</view>
				<view class="content">
					<text v-if="detailsData.gender == 'male'">男</text>
					<text v-if="detailsData.gender == 'female'">女</text>
				</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">民族</view>
				<view class="content">{{detailsData.nation}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">出生日期</view>
				<view class="content">{{detailsData.birthday}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">籍贯</view>
				<view class="content">{{detailsData.nativePlace}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">毕业院校</view>
				<view class="content">{{detailsData.college}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">系(学院)</view>
				<view class="content">{{detailsData.departmentName}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">专业名称</view>
				<view class="content">{{detailsData.specialityName}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">班级名称</view>
				<view class="content">{{detailsData.className}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">联系电话</view>
				<view class="content">{{detailsData.phone}}</view>
			</view>
			<view class="flex-row flex-row-space-between item-dom">
				<view class="title">联系邮箱</view>
				<view class="content">{{detailsData.email}}</view>
			</view>
		</view>
	</uni-card>
</template>

<script lang="ts" setup>
	import { User } from "@/api/tables/User"
	import { getBasicInfo } from "@/api/preview"
	import { ref, onBeforeMount } from 'vue'

	const props = defineProps({
		userData: {
			type: Object,
			default: function () {
				return {};
			}
		}
	})
	let detailsData = ref<User>({})

	onBeforeMount(() => {
		getDetail(props.userData)
	})
	function getDetail(obj) {
		getBasicInfo(obj).then(res => {
			if (res.code == '200') {
				detailsData.value = res.data
			}
		})
	}
</script>

<style lang="scss" scoped>

</style>